package com.scau402.system1.domain.factory;

import com.scau402.common.utils.bean.BeanUtils;
import com.scau402.system1.domain.dto.WmsAuditOrderDTO;
import com.scau402.system1.domain.po.WmsAdjustBoundOrderDetailPO;
import com.scau402.system1.domain.po.WmsAuditOrderPO;
import com.scau402.system1.repository.IWmsAdjustDetailRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 审核单实体工厂类
 */
@Component
public class WmsAuditOrderFactory {
    @Autowired
    private IWmsAdjustDetailRepository adjustDetailRepo;

    /**
     * 将审核单PO转换为用于展示的DTO对象
     * @param po 审核单PO
     * @param related 关联的数据对象
     * @return DTO
     * @param <T> 关联数据类型
     */
    public <T> WmsAuditOrderDTO<T> POToDTO(WmsAuditOrderPO po,T related){
        WmsAuditOrderDTO<T> dto = new WmsAuditOrderDTO<>();
        BeanUtils.copyProperties(po,dto);
        dto.setRelated(related);
        return dto;
    }
}
